# Contributor: zhuqin <zhuqin83@gmail.com>

pkgname=x264-git
pkgver=20090615
pkgrel=1
pkgdesc="free library for encoding H264/AVC video streams"
arch=('i686' 'x86_64')
license=('GPL')
depends=('libx11')
makedepends=('git' 'yasm' 'gettext')
url="http://www.videolan.org/developers/x264.html"
conflicts=('x264')
replaces=(x264-svn)
provides=("x264=$pkgver")
source=()
md5sums=()

_gitroot="git://git.videolan.org/x264.git"
_gitname="x264"

build() {
  cd $srcdir
  msg "Connecting to the GIT server...."
  
  if [[ -d $srcdir/$_gitname ]] ; then
    cd $_gitname
    git pull origin
    msg "The local files are updated."
  else
    git clone $_gitroot
  fi
  
  msg "GIT checkout done"
  msg "Starting make..."
  
  rm -rf $srcdir/$_gitname-build
  git clone $srcdir/$_gitname $srcdir/$_gitname-build
  
  cd $srcdir/$_gitname-build

  ./configure --prefix=/usr \
    --enable-visualize \
    --enable-shared \
    --enable-pthread \
    --enable-pic || return 1
  
  make || return 1
  make DESTDIR=$pkgdir install || return 1
  
  rm -rf $srcdir/$_gitname-build
}
